const { validate } = require('./validate');
const { body } = require('express-validator');
// const { getAccountInfoByUsername } = require('../model/account');

module.exports.loginValidator = [
  validate([body('username').notEmpty(), body('password').notEmpty()]),
  // validate([
  //   body('username').custom(async (username) => {
  //     let accounts = await getAccountInfoByUsername(username);
  //     if (accounts.length !== 0) {
  //       return Promise.reject('Account exists.');
  //     }
  //   }),
  // ]),
];
